package com.next

class ProductType
{
	String name

    Boolean active = true
    Boolean allowAddSize = false

    Date createdDate = new Date()
    Date modifiedDate = new Date()

    static constraints = {
        createdDate nullable: true, blank: true
        modifiedDate nullable: true, blank: true
        name maxSize: 64
        active nullable: true, blank: true
        allowAddSize nullable: true, blank: true
    }

    static mapping = {
        sort 'name'
        cache true
    }

    def beforeInsert()
    {
        name = name.trim()
    }

    def beforeUpdate()
    {
        name = name.trim()
        modifiedDate = new Date()
    }
}

